﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EDiamondModel;

public partial class UControl_UCSanPhamYeuThich : System.Web.UI.UserControl
{
    EDiamondEntities1 db = new EDiamondEntities1();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            IQueryable<SanPham> sp = db.SanPhams.Include("DatHangCTs").OrderByDescending(p => p.DatHangCTs.Sum(x => x.SoLuong)).Skip(2).Take(3);
            ddlSanPhamYeuThich.DataSource = sp.ToList();
            ddlSanPhamYeuThich.DataBind();
        }
    }
}